package openase.audiosearch.comm.request.decoder;

import java.nio.ByteBuffer;

import openase.audiosearch.comm.request.AudioSearch;


public class AudioSearchRequestDecoder implements RequestDecoder<AudioSearch> {

	public AudioSearch decode(ByteBuffer inputBuffer) {
		int sz = inputBuffer.getInt();
		byte[] audioBytes = new byte[sz];
		inputBuffer.get(audioBytes);
		int maxResults = inputBuffer.getInt();

		return new AudioSearch(audioBytes, maxResults);
	}
}
